package wyszukiwanieLukow;

import java.awt.Point;

public class Linia {
	
    public int sx;
    public int sy;
    public int ex;
    public int ey;
    public double bladAproksymacji;
    
    public Linia(int sx, int sy, int ex, int ey) {
        this.sx = sx;
        this.sy = sy;
        this.ex = ex;
        this.ey = ey;
    }
    
    public String toString(){
    	return sx+";"+sy+";"+ex+";"+ey+"   - blad: "+bladAproksymacji;
    }
    
    public double getLength(){
    	return Point.distance(sx, sy, ex, ey);
    }

	@Override
	public int hashCode() {
		final int prime = 31;
		int result = 1;
		result = prime * result + this.ex;
		result = prime * result + this.ey;
		result = prime * result + this.sx;
		result = prime * result + this.sy;
		return result;
	}

	@Override
	public boolean equals(Object obj) {
		if (this == obj)
			return true;
		if (obj == null)
			return false;
		if (getClass() != obj.getClass())
			return false;
		Linia other = (Linia) obj;
		if (this.ex != other.ex)
			return false;
		if (this.ey != other.ey)
			return false;
		if (this.sx != other.sx)
			return false;
		if (this.sy != other.sy)
			return false;
		return true;
	}
    
    
}
